<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/bootstrap-theme.min.css" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/user.css" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/ui-box.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/ui-base.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/ui-color.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/appcan.icon.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/appcan.control.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/weui.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/css/example.css">
        <script type="text/javascript" src="${pageContext.request.contextPath}/resources/js/jquery.min.js"></script>
    	<script src="${pageContext.request.contextPath}/resources/vendor/jquery-easing/jquery.easing.min.js"></script>
    	<script src="${pageContext.request.contextPath}/resources/vendor/datatables/jquery.dataTables.js"></script>
    </head>
    <body class="um-vp " ontouchstart>
        <div id="page_0" class="up ub ub-ver bc-bg" tabindex="0">
            <!--header开始-->
            <div id="header" class="uh bc-text-head ub bc-head">
                <div class="nav-btn" id="nav-left">
                    <div class="fa fa-angle-left fa-2x" style="font-size: 18px"   onclick="location.href='${pageContext.request.contextPath}/consumer/customer/index'"> 返回</div>
                </div>
                <h1 class="ut ub-f1 ulev-3 ut-s tx-c" tabindex="0">小贷</h1>
                <div class="nav-btn nav-bt" id="nav-right"></div>
            </div>
            <!--header结束--><!--content开始-->
            <div id="content" class="ub-f1 tx-l" style="background-color:#DCDCDC">
                <form action="${pageContext.request.contextPath}/consumer/order/borrow_do" method="post" onsubmit="return ff()"> 
            	<div class="weui_cells weui_cells_form" style="margin-top: 0;">
	                <div class="weui_cell">
		                <div class="weui_cell_hd"  style="width: 35%;font-size: 100%;"><label class="weui_label" style="width: 100%;">借款金额</label></div>
		                <div class="weui_cell_bd weui_cell_primary" style="width: 60%;">
		                    <input class="weui_input" id="money" type="number" pattern="[0-9]*" name="apply_money" placeholder="请输入借款金额" style="width: 80%;">元
		                </div>
		            </div>
                </div>
                <div class="weui_cells_title">请选择借款期限</div>
                <div class="weui_cells weui_cells_radio">
                	<c:forEach var="Vo" items="${cost}" >
			            <label class="weui_cell weui_check_label" for="x${Vo.cost_id}">
			                <div class="weui_cell_bd weui_cell_primary">
			                    <span>${Vo.cost_month}个月（分期）</span>
			                </div>
			                <div class="weui_cell_ft">
			                    <input type="radio" class="weui_check" name="month" id="x${Vo.cost_id}" value="${Vo.cost_id}" onclick="f(${Vo.cost_month},${Vo.cost_day_rate})"/>
			                    <span class="weui_icon_checked"></span>
			                </div>
			            </label>
                   </c:forEach>
		        </div>
		        <div class="text-center">
		        	<p id="lixi"></p>
                    <p style="color:red;">${tishi}</p>                         
                </div>
		        <div class="text-center">
		        	<input type="submit" value="马上借款" class="btn btn-default btn-sm" />
		        </div>
               </form>
               <script>
               	function f( cost_month, cost_day_rate){ 
               		var zon = $("#money").val() * cost_month *30*cost_day_rate;
               		document.getElementById("lixi").innerHTML="❈总利息约为"+zon+"元";
               	}
               	function ff(){
               		if($("#money").val()==""){
						alert("请输入借款金额！");
						return false;
					}else if($("#money").val()<=0){
						alert("请输入正数！");
						return false;
					}else if($("#money").val()>${rz_surplus_money}){
						alert("可用额度不足！");
						return false;
					}else if($("#money").val()%100==0){
						return true;
					}else{
						alert("请输入整百金额！");
						return false;
					}
               	}
               </script>
            </div> 
            <!--content结束-->
        </div>
    </body>
</html>